/* ================================================================================
//	Crypteviant!
//	Providing tough encrypted P2P Chat
//	Copyright (C) 2010  Martin Pfeifer, Tobias Rausch
//
//	This program is free software: you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation, either version 3 of the License, or
//	(at your option) any later version.
//
//	This program is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU General Public License
//	along with this program.  If not, see <http://www.gnu.org/licenses/>.
// ============================================================================== */

#ifndef TIMERWIN_HPP
#define TIMERWIN_HPP

#include <QtCore/QObject>

#include "abstracttimer.hpp"
#include "highrestimerwin.hpp"
#include "standardtimerwin.hpp"



namespace Timer {

    /**
     * @brief Timer class for windows
     * @details Native Windows impementation. Supports multiple OS specific Timers.\n
     * The one with the best resolution on the system will be used
     *
     * @class TimerWin timerwin.hpp "timerwin.hpp"
    */
    class TimerWin : public AbstractTimer
    {
        Q_OBJECT
    public:
        /**
         * @brief Default Constructor
         * @details Will initialize the Timer and store the current time in m_startTime
         *
         * @fn TimerWin(QObject*)
         * @param parent
        */
        explicit TimerWin(QObject *parent = 0);

        /**
         * @brief Get the current time
         *
         * @fn getCurrentTime() const
         * @return unsigned long
        */
        unsigned long getCurrentTime() const;

    public slots:
        /**
         * @brief Start the Timer
         * @details This will store the current time in m_startTime. Also m_stopTime will be reset.\n
         * The signal \ref AbstractTimer::started(unsigned long) will be emitted
         *
         * @fn start()
        */
        void start();

        /**
         * @brief Stop the Timer
         * @details This will store the current time in m_stopTime.\n
         * The signals \ref AbstractTimer::stopped(unsigned long) and \ref AbstractTimer::stopped(unsigned long, unsigned long) are emitted
         *
         * @fn stop()
        */
        void stop();

    private:
        /**
         * @var m_useHighResolution
         * @details Variable representing if a high resolution timer is available
        */
        bool m_useHighResolution;

    };

} // End of Namespace Timer

#endif // TIMERWIN_HPP
